#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 - 2013 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1

#include <Macros.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Termstructures/InflationTermStructure.h>
#pragma unmanaged 
#include <ql\experimental\inflation\cpicapfloortermpricesurface.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;
using namespace Cephei::Core;
using namespace PLATFORM::Collections;

using namespace Cephei::QL::Times;
using namespace Cephei::QL::Math;
using namespace Cephei::QL::Indexes;
using namespace Cephei::QL::Termstructures;
using namespace Cephei::QL::Termstructures::Inflation;
#define HANDLE
#define ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Experimental { namespace Inflation {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of ICPICapFloorTermPriceSurface
	public ref class CCPICapFloorTermPriceSurface  : 
            public CInflationTermStructure,
            public Cephei::QL::Experimental::Inflation::ICPICapFloorTermPriceSurface
	{
	protected: 
		boost::shared_ptr<QuantLib::CPICapFloorTermPriceSurface>* _ppCPICapFloorTermPriceSurface;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::CPICapFloorTermPriceSurface>* _phCPICapFloorTermPriceSurface;
#endif
		Object^ _CPICapFloorTermPriceSurfaceOwner;     // reference to object that manages the storage for this object
	internal:
        CCPICapFloorTermPriceSurface (boost::shared_ptr<QuantLib::CPICapFloorTermPriceSurface>& childNative, Object^ owner);
        CCPICapFloorTermPriceSurface (QuantLib::CPICapFloorTermPriceSurface& childNative, Object^ owner);
        CCPICapFloorTermPriceSurface (CCPICapFloorTermPriceSurface^ copy);
        CCPICapFloorTermPriceSurface (PLATFORM::Type^ t);
#ifdef STRUCT
        CCPICapFloorTermPriceSurface (QuantLib::CPICapFloorTermPriceSurface childNative);
#endif       
#ifdef HANDLE
		CCPICapFloorTermPriceSurface (QuantLib::Handle<QuantLib::CPICapFloorTermPriceSurface>& childNative, Object^ owner);
		CCPICapFloorTermPriceSurface (QuantLib::Handle<QuantLib::CPICapFloorTermPriceSurface> childNative);
#endif
		virtual ~CCPICapFloorTermPriceSurface ();
		!CCPICapFloorTermPriceSurface ();

	internal:
		QuantLib::CPICapFloorTermPriceSurface& GetReference ();
		boost::shared_ptr<QuantLib::CPICapFloorTermPriceSurface>& GetShared ();
		QuantLib::CPICapFloorTermPriceSurface* GetPointer ();
        void SetCPICapFloorTermPriceSurface (boost::shared_ptr<QuantLib::CPICapFloorTermPriceSurface> native)
        {
            if (_ppCPICapFloorTermPriceSurface != NULL)
                delete _ppCPICapFloorTermPriceSurface;
            _ppCPICapFloorTermPriceSurface = new boost::shared_ptr<QuantLib::CPICapFloorTermPriceSurface> (native);
            SetInflationTermStructure (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppCPICapFloorTermPriceSurface));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::CPICapFloorTermPriceSurface>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property DateTime BaseDate 
        {
		    virtual DateTime get () ;
        }
        property QL::Times::BusinessDayConventionEnum BusinessDayConvention 
        {
		    virtual QL::Times::BusinessDayConventionEnum get () ;
        }
		virtual Double CapPrice (DateTime d, Double k) ;
		virtual Double CapPrice (Cephei::QL::Times::IPeriod^ d, Double k) ;
        property Cephei::QL::Math::IMatrix^ CapPrices 
        {
		    virtual Cephei::QL::Math::IMatrix^ get () ;
        }
        property Cephei::Core::IVector<Double>^ CapStrikes 
        {
		    virtual Cephei::Core::IVector<Double>^ get () ;
        }
		virtual DateTime CpiOptionDateFromTenor (Cephei::QL::Times::IPeriod^ p) ;
		virtual Double FloorPrice (DateTime d, Double k) ;
		virtual Double FloorPrice (Cephei::QL::Times::IPeriod^ d, Double k) ;
        property Cephei::QL::Math::IMatrix^ FloorPrices 
        {
		    virtual Cephei::QL::Math::IMatrix^ get () ;
        }
        property Cephei::Core::IVector<Double>^ FloorStrikes 
        {
		    virtual Cephei::Core::IVector<Double>^ get () ;
        }
        property Cephei::Core::IVector<Cephei::QL::Times::IPeriod^>^ Maturities 
        {
		    virtual Cephei::Core::IVector<Cephei::QL::Times::IPeriod^>^ get () ;
        }
        property DateTime MaxDate 
        {
		    virtual DateTime get () ;
        }
        property Double MaxStrike 
        {
		    virtual Double get () ;
        }
        property DateTime MinDate 
        {
		    virtual DateTime get () ;
        }
        property Double MinStrike 
        {
		    virtual Double get () ;
        }
        property Double Nominal 
        {
		    virtual Double get () ;
        }
        property Cephei::QL::Times::IPeriod^ ObservationLag 
        {
		    virtual Cephei::QL::Times::IPeriod^ get () ;
        }
		virtual Double Price (DateTime d, Double k) ;
		virtual Double Price (Cephei::QL::Times::IPeriod^ d, Double k) ;
        property Cephei::Core::IVector<Double>^ Strikes 
        {
		    virtual Cephei::Core::IVector<Double>^ get () ;
        }
        property Cephei::QL::Indexes::IZeroInflationIndex^ ZeroInflationIndex 
        {
		    virtual Cephei::QL::Indexes::IZeroInflationIndex^ get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
//z	[FactoryFor(Core::Generic::ICoCell<Cephei::QL::Experimental::Inflation::ICPICapFloorTermPriceSurface^>::typeid)]
	[FactoryFor(Cephei::QL::Experimental::Inflation::ICPICapFloorTermPriceSurface::typeid)]
	[FactoryFor(Cephei::QL::Experimental::Inflation::ICPICapFloorTermPriceSurface_Factory::typeid)]
	public ref class CCPICapFloorTermPriceSurface_Factory sealed : public ICPICapFloorTermPriceSurface_Factory
	{
	public:
    };
   
/*Cephei*/ } /*QL*/ } /*Experimental*/ } /*Inflation */}
